import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Css from '../src/assets/mdsmyu.css'
import './assets/font/iconfont.css'
import axios from 'axios'
// 解决pc端无法滑动swipe
import '@vant/touch-emulator';
import Vant from 'vant';
import 'vant/lib/index.css';
import store from './store'
// 引入时间格式化组件库
import moment from 'moment'
// 导入swiper
import { Swiper, SwiperSlide } from 'vue-awesome-swiper' // 导入组件
import "swiper/css/swiper.css"; // 导入样式
// 引入
import animated from "animate.css";
// Vue.use(animated)
Vue.prototype.animated = animated;
import bottomList from '../src/components/bottomList/bottomList'
import topList from '../src/components/topList/topList'
import Carousel from '../src/components/Carousel/Carousel'
import CarouselList from '../src/components/Carousel/CarouselList'
import CarouselListtoo from '../src/components/Carousel/CarouselListtoo'
// 注册为全局组件
Vue.component('bottomList',bottomList)
Vue.component('topList',topList)
Vue.component('Carousel',Carousel)
Vue.component('CarouselList',CarouselList)
Vue.component('CarouselListtoo',CarouselListtoo)
// 定义时间过滤器 date是时间过滤器名称
// Vue.filter('dateTime', function(dataStr, pattern = 'YYYY-MM-DD') {
//   return moment(dataStr).format(pattern)
// })
Vue.filter('date', function (n) {
  const result = moment(n * 1000).format('YYYY-MM-DD') // 转换时间格式
  return result // 返回出去 否则不会生效
})
Vue.use(Vant);
// 解决路由跳转新页面后显示不在顶部
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0)
})
// Vue.use(Css)
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')
